rustc_info_cache: Option<PathBuf>,
mode: CompileMode,
) -> CargoResult<BuildConfig> {
- if let &Some(ref s) = requested_target {
+ let requested_target = match requested_target {
+ &Some(ref target) if target.ends_with(".json") => {
+ let path = Path::new(target)
+ .canonicalize()
+ .chain_err(|| format_err!("Target path {:?} is not a valid file", target))?;
+ Some(path.into_os_string()
+ .into_string()
+ .map_err(|_| format_err!("Target path is not valid unicode"))?)
+ }
+ other => other.clone(),
+ };
+ if let Some(ref s) = requested_target {
if s.trim().is_empty() {
bail!("target was empty")
}
let cfg_target = config.get_string("build.target")?.map(|s| s.val);
let target = requested_target.clone().or(cfg_target);
+ if jobs == Some(0) {
+ bail!("jobs must be at least 1")
+ }
if jobs.is_some() && config.jobserver_from_env().is_some() {
config.shell().warn(
"a `-j` argument was passed to Cargo but Cargo is \
//!
use std::collections::HashSet;
-use std::path::{Path, PathBuf};
+use std::path::PathBuf;
use std::sync::Arc;
use core::compiler::{BuildConfig, BuildContext, Compilation, Context, DefaultExecutor, Executor};
use core::{PackageId, PackageIdSpec, TargetKind, Workspace};
use ops;
use util::config::Config;
-use util::{lev_distance, profile, CargoResult, CargoResultExt};
+use util::{lev_distance, profile, CargoResult};
/// Contains information about how a package should be compiled.
#[derive(Debug)]
ref export_dir,
} = *options;
- let target = match target {
- &Some(ref target) if target.ends_with(".json") => {
- let path = Path::new(target)
- .canonicalize()
- .chain_err(|| format_err!("Target path {:?} is not a valid file", target))?;
- Some(path.into_os_string()
- .into_string()
- .map_err(|_| format_err!("Target path is not valid unicode"))?)
- }
- other => other.clone(),
- };
-
- if jobs == Some(0) {
- bail!("jobs must be at least 1")
- }
-
let rustc_info_cache = ws.target_dir()
.join(".rustc_info.json")
.into_path_unlocked();